#include "../../include/core/container.h"
#include <cstring>
#include <iostream>

#define INPUT_SIZE 3
#define OUTPUT_SIZE 16

extern "C" {
void MD5OP(MemRef<unsigned char, 1> *, int, MemRef<unsigned char, 1> *);
}

void printResult(uint8_t *output) {
  // Print the output.
  std::cout << "[ ";
  for (size_t i = 0; i < OUTPUT_SIZE; i++) {
    printf("%02x", (uint8_t)output[i]);
  }
  std::cout << " ]" << std::endl;
}

void printInput(uint8_t *input) {
  // Print the input.
  std::cout << "Input : [ ";
  for (size_t i = 0; i < INPUT_SIZE; i++) {
    printf("%c", input[i]);
  }
  std::cout << " ] ==> ";
}

int main() {
  unsigned char exampleInput[] = {0x61, 0x62, 0x63};
  unsigned char exampleOutputMulti[2000]{0};
  int n = sizeof(exampleInput);
  MemRef<unsigned char, 1> input{exampleInput, n};
  MemRef<unsigned char, 1> outputMulti{exampleOutputMulti, 2000};

  MD5OP(&input, n, &outputMulti);
  printInput(exampleInput);
  printResult(exampleOutputMulti);
  return 0;
}
